package com.chen.user.repository.service;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @author ex_chenzy59
 * @since 2025/6/11
 */
public interface IService<T> extends com.baomidou.mybatisplus.extension.service.IService<T> {

    default LambdaQueryChainWrapper<T> queryLambda() {
        return new LambdaQueryChainWrapper<>(getBaseMapper(), getEntityClass());
    }

    public static class LambdaQueryChainWrapper<T> extends com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper<T>{
        public LambdaQueryChainWrapper(BaseMapper<T> baseMapper, Class<T> entityClass) {
            super(baseMapper, entityClass);
        }
        @Override
        public T one(){
            last("limit 1");
            return super.one();
        }
    }
}
